home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 854 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. Path: btree.is.brooktree.com!usenet
  2. From: sasha@brooktree.com (Alex Bakaev)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: (HUGE) Help!  This bug is killing me!  Anyone have any ideas?
  5. Date: Sun, 07 Jan 1996 23:11:19 GMT
  6. Organization: Brooktree Corporation
  7. Message-ID: <4cpjuc$qt8@btree.brooktree.com>
  8. References: <4cjmbt$gaf@maverick.tad.eds.com>
  9. NNTP-Posting-Host: komissar.is.brooktree.com
  10. X-Newsreader: Forte Free Agent v0.46
  11.  
  12. fignet05.darrins@eds.com (Darrin Smith) wrote:
  13.  
  14. >First off thanks for reading (sorry this is so HUGE) and helping me save my 
  15. >sanity.
  16.  
  17. >Now, the following program seems to work perfectly until the final statement, 
  18. >at which time Win95 reports that an execution of an invalid instruction has 
  19. >been attenmpted, and that the program will be terminated.
  20.  
  21. >Well I've spent 3 days now trying to figure out what is wrong with this 
  22. >thing, and I've finally decided to enlist YOUR help.  I know that somewhere 
  23. >core is getting clobbered, but where I cannot tell.
  24.  
  25.  
  26. Well, it seems very simple: you have a pointer detail you forgot to
  27. initialize by allocating memory for it.
  28. [deleted]
  29.  
  30. > ccun_detail *detail;
  31. [deleted]
  32. >    if(!bad)
  33. >      found=fread(detail,sizeof(ccun_detail),1,infile);
  34. You are using uninitialized pointer in the line above
  35.  
  36. [deleted]
  37.  
  38.  
  39. You would've caught this bug right away if you had _all_ compiler
  40. warnings enabled ( at least in Borland compiler ).  That's how I found
  41. it.
  42.  
  43. Good luck, alex
  44.  
  45.  
  46.